/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package appchatagentes;

import jade.gui.GuiEvent;

/**
 *
 * @author publico
 */
public class VentanaChat extends javax.swing.JFrame {

    /**
     * Creates new form VentanaChat
     */
    TalkAgent propietario;
    
    public void adicionarMensaje(String m){
        this.jTextArea1.append(m + '\n');}
		
		 public void adicionarMensaje2(String m){
        this.jTextArea1.append(m + '\n');}
		
		 public void adicionarMensaje3(String m){
        this.jTextArea1.append(m + '\n');}

    public VentanaChat(TalkAgent ag) {
        initComponents();
        this.propietario = ag;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jPanel1.setBackground(new java.awt.Color(51, 51, 255));
        jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
        jPanel1.setLayout(null);

        jLabel1.setText("Chat agentes");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(180, 30, 80, 14);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(-10, 0, 410, 80);

        jPanel2.setBackground(new java.awt.Color(0, 102, 204));
        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jPanel2.setLayout(null);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        jPanel2.add(jScrollPane1);
        jScrollPane1.setBounds(16, 6, 370, 100);

        getContentPane().add(jPanel2);
        jPanel2.setBounds(0, 80, 400, 120);

        jPanel3.setBackground(new java.awt.Color(0, 102, 102));
        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel3.setLayout(null);

        jLabel2.setText("Nombre Agente");
        jPanel3.add(jLabel2);
        jLabel2.setBounds(70, 10, 100, 14);

        jLabel3.setText("Mensaje");
        jPanel3.add(jLabel3);
        jLabel3.setBounds(70, 40, 80, 20);

        jTextField1.setText("jTextField1");
        jPanel3.add(jTextField1);
        jTextField1.setBounds(190, 10, 160, 20);

        jTextField2.setText("jTextField2");
        jPanel3.add(jTextField2);
        jTextField2.setBounds(190, 40, 160, 20);

        jButton1.setText("Enviar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton1);
        jButton1.setBounds(190, 70, 63, 23);

        getContentPane().add(jPanel3);
        jPanel3.setBounds(0, 200, 400, 110);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        GuiEvent evento = new GuiEvent(evt, 1);
        evento.addParameter(this.jTextField1.getText());
        evento.addParameter(this.jTextField2.getText());
        this.propietario.postGuiEvent(evento);

    }//GEN-LAST:event_jButton1ActionPerformed
    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    // End of variables declaration//GEN-END:variables
}
